Lesson 0001 · ~15 min

An LLM is a next-token machine

Mission tie-in: if you want to understand transformers deeply and use LLMs effectively, the first non-negotiable idea is this: an LLM does not “think in sentences” or “retrieve meanings directly.” It repeatedly predicts the next token.

Win for this lesson

By the end, you should be able to explain:

“What is an LLM actually doing at generation time?”

Core idea

An LLM takes a sequence of tokens as input and outputs a probability distribution over possible next tokens. One token is chosen, appended to the sequence, and the process repeats.

That is the engine underneath everything impressive it does.

Why this matters

Mental model

Think of the model as doing this loop:

  1. Read the tokens so far
  2. Compute which next tokens are plausible
  3. Choose one token
  4. Add it to the context
  5. Repeat

Long answers are just this loop happening many times.

What this does not mean

Pressure-test yourself

Prompt A

In 1–2 sentences: what is an LLM doing when it answers a question?

Prompt B

Why does prompting work, if the model is “just” predicting the next token?

Benchmark answers

Prompt A: An LLM reads the token sequence consisting of the prompt plus prior generated tokens, then predicts a distribution over likely next tokens. It generates an answer by repeating that prediction-and-append loop many times.

Prompt B: Prompting works because the prompt changes the context, and the context changes the next-token probabilities. Good prompts push the model into the pattern you want it to continue.

Mini drill

Take this weak statement:

The model looks up the answer and returns it.

Rewrite it into a safer statement using tokens, context, and next-token prediction.

Send me your version and I’ll critique it.

Takeaway

Everything starts here: an LLM is a system that repeatedly predicts the next token from context. If you keep this fixed in your head, later ideas like embeddings, attention, training, sampling, and hallucinations become much easier to understand.

Next step options

Reference: Reference 0001

Ask followup questions anytime — I can adapt the next lesson to your pace.